home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / program / palis.lha / Palis / src / vpl / Main.c < prev    next >
C/C++ Source or Header  |  1992-09-02  |  2KB  |  140 lines

  1. /*
  2.     ·C·O·D·E·X· ·D·E·S·I·G·N· ·S·O·F·T·W·A·R·E·
  3.     presents
  4.  
  5.     PatchLibraries Utility / VIEW
  6.  
  7.     FILE:    main.c
  8.     TASK:    mainloop
  9.  
  10.     (c)1995 by Hans Bühler, h0348kil@rz.hu-berlin.de
  11. */
  12.  
  13. #include    "plView.h"
  14.  
  15. // ---------------------------
  16. // defines
  17. // ---------------------------
  18.  
  19. // ---------------------------
  20. // datatypes
  21. // ---------------------------
  22.  
  23. // ---------------------------
  24. // proto
  25. // ---------------------------
  26.  
  27. // ---------------------------
  28. // vars
  29. // ---------------------------
  30.  
  31. // ---------------------------
  32. // funx
  33. // ---------------------------
  34.  
  35. void MainLoop(void)
  36. {
  37.     CxMsg                *cxmsg;
  38.     ULONG                rec,cxID,cxType;
  39.     BOOL                quit;
  40.  
  41.     ActivateCxObj(CxMain,TRUE);
  42.  
  43.     if(ttGetBool(&tt[ARG_CX_POPUP]))
  44.         OpenWin();
  45.  
  46.     quit    =    FALSE;
  47.  
  48.     do
  49.     {
  50.         rec    =    (1 << CxPort->mp_SigBit) |
  51.                     (MainWnd ? (1 << MainWnd->UserPort->mp_SigBit) : 0);
  52.  
  53.         rec    =    Wait(rec);
  54.  
  55.         // -- cx events --
  56.  
  57.         if(rec & (1 << CxPort->mp_SigBit))
  58.             while(cxmsg = (APTR)GetMsg(CxPort))
  59.             {
  60.                 cxID        =    CxMsgID(cxmsg);
  61.                 cxType    =    CxMsgType(cxmsg);
  62.  
  63.                 ReplyMsg((APTR)cxmsg);
  64.  
  65.                 switch(cxType)
  66.                 {
  67.                     case    CXM_IEVENT    :    // (=> cxID == CXE_POPUP)
  68.  
  69.                                 if(MainWnd)
  70.                                     CloseWin();
  71.                                 else
  72.                                     OpenWin();
  73.                                 break;
  74.  
  75.                     case    CXM_COMMAND    :
  76.  
  77.                                 switch(cxID)
  78.                                 {
  79.                                     case    CXCMD_APPEAR:
  80.                                     case    CXCMD_UNIQUE:
  81.  
  82.                                                 OpenWin();
  83.                                                 break;
  84.  
  85.                                     case    CXCMD_DISAPPEAR    :
  86.  
  87.                                                 CloseWin();
  88.                                                 break;
  89.  
  90.                                     case    CXCMD_DISABLE    :
  91.                                     case    CXCMD_ENABLE    :
  92.  
  93.                                                 break;                // bis jetzt keine Funktion
  94.  
  95.                                     case    CXCMD_KILL    :
  96.  
  97.                                                 quit    =    TRUE;
  98.                                                 break;
  99.  
  100.                                     default    :
  101.  
  102.                                                 break;
  103.                                 }
  104.                 }
  105.             }
  106.  
  107.         // -- window stuff --
  108.  
  109.         if(!quit && MainWnd && (rec & (1 << MainWnd->UserPort->mp_SigBit)))
  110.             switch(HandleMainIDCMP())
  111.             {
  112.                 case    CMD_OKAY    :
  113.  
  114.                             break;
  115.  
  116.                 case    CMD_QUIT    :
  117.  
  118.                             quit    =    TRUE;
  119.                             break;
  120.  
  121.                 case    CMD_HIDE    :
  122.  
  123.                             CloseWin();
  124.                             break;
  125.  
  126.                 case    CMD_ERRORBEEP    :
  127.  
  128.                             DisplayBeep(MainWnd->WScreen);
  129.  
  130.                 case    CMD_REFRESH:
  131.  
  132.                             break;
  133.             }
  134.     }
  135.     while(!quit);
  136.  
  137.     ActivateCxObj(CxMain,FALSE);
  138.     CloseWin();
  139. }
  140.